import request from '../base.ts'

const url = '/activity-information';

export const getList = (page: number, limit: number, params?: IObj) => {
  return request.get(`${url}/${page}/${limit}`, {
    params
  })
}

// 添加活动
export const addActivity = (params: IObj, data?: IObj) => {
  return request({
    url: `${url}/add`,
    method: 'post',
    params,
    data
  })
}

// 删除活动
export const deleteActivity = (id: number) => {
  return request.delete(`${url}/deleted`, {
    params: {
      _id: id
    }
  })
}

export const deleteActivityList = (data: number[]) => {
  return request.delete(`${url}/deletedList`, {
    data
  });
}

// 更新活动
export const updateActivity = (data: IObj) => {
  // return request.post(`${url}/update`, data);
  return request({
    url: `${url}/update`,
    method: 'post',
    params: data
  });
}

export const getAll = () => {
  return request.get(`${url}/getAll`);
}